<template>
    <div class="app-container">
<!--        <el-button type="primary" @click="dialogFormVisible = true">新增</el-button>-->
        <el-divider></el-divider>
        <el-table :data="list" border fit highlight-current-row>
            <el-table-column prop="id" label="ID" width="60"></el-table-column>
            <el-table-column prop="companyCertification.name" label="认证名称"></el-table-column>
            <el-table-column prop="companyCertification.agreement_code" label="合同编号"></el-table-column>
            <el-table-column prop="companyCertification.agreementOriginName" label="合同来源"></el-table-column>
<!--            <el-table-column prop="certificationCode" label="认证编号"></el-table-column>-->
            <el-table-column prop="certificationName" label="认证名称"></el-table-column>
            <el-table-column prop="certificationPeople" label="认证人数"></el-table-column>
            <el-table-column prop="companyCertificationTypeName" label="认证类型"></el-table-column>
            <el-table-column prop="createTime" label="创建时间"></el-table-column>
            <el-table-column label="操作" width="180">
                <template slot-scope="scope">
                    <el-button size="mini" @click="$router.push({path: `certification-detail/edit/${scope.row.id}`})">编辑</el-button>
                    <!--                    <el-button size="mini" @click="onEdit(scope.$index, scope.row)">编辑</el-button>-->
                </template>
            </el-table-column>
        </el-table>

        <el-dialog title="收货地址" :visible.sync="dialogFormVisible">
            <el-form :model="form">
                <el-form-item label="企业名称" :label-width="formLabelWidth">
                    <el-input v-model="form.name" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item label="体系名称" :label-width="formLabelWidth">
                    <el-select v-model="form.certificationId" placeholder="体系名称">
                        <el-option v-for="item in optsCertification" :key="item.value" :label="item.label"
                                   :value="item.value"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="审核类型" :label-width="formLabelWidth">
                    <el-select v-model="form.auditType" placeholder="审核类型">
                        <el-option v-for="item in optsAuditType" :key="item.value" :label="item.label"
                                   :value="item.value"></el-option>
                    </el-select>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
    import { mapGetters } from 'vuex';
    import request from '../../utils/request';
    import { getOptions } from '@/api/util';

    export default {
        name: "CompanyCertification",
        computed: {
            ...mapGetters([
                'options'
            ])
        },
        data () {
            return {
                list: [],
                page: 1,

                dialogFormVisible: false,
                form: {
                    name: '',
                    certificationId: '',
                    auditType: '',
                },
                optsCertification: [],
                optsAuditType: [],
                formLabelWidth: '120px'
            };
        },
        mounted () {
            this.getItems();
        },
        methods: {
            getItems () {
                request({
                    url: '/api/certification-detail/index'
                }).then(res => {
                    this.list = res.data.list;
                    // console.log(res.data)
                });
            },
        }
    };
</script>

<style scoped>

</style>
